import {
  PrimaryGeneratedColumn,
  Column,
  JoinColumn,
  ManyToOne,
  Entity,
} from 'typeorm';
import { TcUsers } from './users';

@Entity()
export class TcContents {
  @PrimaryGeneratedColumn()
  cid!: number;
  @Column({ length: 200 })
  title!: string;
  @Column({ length: 200 })
  slug!: string;
  @Column()
  created!: number;
  @Column()
  modified!: number;
  @Column('text')
  text!: string;
  @Column()
  order!: number;
  @ManyToOne(
    type => TcUsers,
    user => user.uid,
  )
  @JoinColumn()
  authorId!: number;
  @Column({ length: 32 })
  template!: string;
  @Column({ length: 16 })
  type!: string;
  @Column({ length: 16 })
  status!: string;
  @Column({ length: 32 })
  password!: string;
  @Column()
  commentsNum!: number;
  @Column('char')
  allowComment!: string;
  @Column('char')
  allowPing!: string;
  @Column('char')
  allowFeed!: string;
}
